package course;

import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;


import course.domain.*;
import course.domain.CourseAttribute.Type;
import course.repository.*;

@SpringBootApplication
public class CourseSelectionApplication {

	public static void main(String[] args) {
		SpringApplication.run(CourseSelectionApplication.class, args);
	}
	@Bean
	public CommandLineRunner dataLoader(CourseAttributeRepository repo) {
		return new CommandLineRunner() {

			@Override
			public void run(String... args) throws Exception {
				 repo.save(new CourseAttribute("1","计算机基础", "c1-202", Type.COMPUTER));
			     repo.save(new CourseAttribute("2", "软件工程","c2-303" ,Type.COMPUTER));
			     repo.save(new CourseAttribute("3", "计算机英语","c5-201" ,Type.ENGLISH));
			     repo.save(new CourseAttribute("4", "大学英语","c5-202" ,Type.ENGLISH));
			     repo.save(new CourseAttribute("5", "离散数学", "d1-101",Type.MATH));
			     repo.save(new CourseAttribute("6", "高等数学", "d2-101",Type.MATH));
			 
				
			}
		
		};
	}
	

}
